﻿using System;

namespace EmbeddedSharp.Core.Function.Arithmetics {

    public class ModNode : OperatorNode {
        public ModNode() {
            Value = "%";
            Precedence = 2;
        }

        public override FuncNode GetReversedFunction(int index) {
            throw new NotImplementedException();
        }

        public override object Evaluate() {
            object value = Left.Evaluate();
            double lr = Convert.ToDouble(value);

            value = Right.Evaluate();
            double rr = Convert.ToDouble(value);

            return (lr % rr).ToString();
        }
    }
}
